package com.gaussic.repository;

import com.gaussic.model.StandardEntity;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;

import java.util.Date;
@Repository
public interface StandardRepository extends JpaRepository<StandardEntity, Integer> {

    // 修改博文操作
    @Modifying
    @Transactional
    @Query("update StandardEntity STD set STD.authorId=:qAuthorId, STD.content=:qContent , STD.createAt=:qCreateAt, STD.title=:qTitle where STD.id=:qId")
    void updateBlog(@Param("qAuthorId") int authorId, @Param("qContent") String content, @Param("qCreateAt") Date createAt, @Param("qTitle") String title, @Param("qId") int id);
}
